using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class RockFindTarget : BaseFindTarget
{

    public float flySpeed = 10;
    private Vector2 flyDir;
    protected override void Awake()
    {
        base.Awake();
        GameObject player =  GameObject.Find("Player");
        //Unity2D获取鼠标空间位置
        var mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        flyDir = (mousePosition - player.transform.position).normalized;
    }

    protected override void Update()
    {
        rb.velocity = flySpeed * flyDir;
    }

    protected override void OnTriggerEnter2D(Collider2D collider2D)
    {
        base.OnTriggerEnter2D(collider2D);
    }
}
